from django.db import models
from doctor.models import Doctor
from patient.models import Patient
from appointment.models import Appointment


# Create your models here.
class Medical_record(models.Model):
    # 标题：病例标题
    title = models.CharField(max_length=255, null=True)

    # 日期：病例日期
    date = models.DateField(auto_now_add=True)

    # 完成状态：是否完成，可以使用布尔字段，True表示完成，False表示未完成
    is_completed = models.BooleanField(default=False, verbose_name="完成状态")

    # 内容：病例的详细内容
    content = models.TextField(null=True, blank=True)

    patient_id = models.ForeignKey(Patient, on_delete=models.CASCADE)

    appointment = models.OneToOneField(Appointment, on_delete=models.CASCADE, related_name='medical_record')
